import time

from packages.viewsclass import Views
from packages.controllerclass import Controller

class Main:
    def __init__(self):
        view = Views()
        controller = Controller()
        main_dict = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'M', 'admin')
        while True:
            print("-----------------------------------------")
            num = input("请输入您要选择的操作 (0 ~ 9) ：")
            if num not in main_dict:
                continue
            if num == '1':
                controller.register()
            elif num == '2':
                controller.query()
            elif num == '3':
                controller.add_money()
            elif num == '4':
                controller.get_money()
            elif num == '5':
                controller.transfer_account()
            elif num == '6':
                controller.change_password()
            elif num == '7':
                controller.lock()
            elif num == '8':
                controller.unlock()
            elif num == '9':
                controller.get_new_card()
            elif num == '0':
                controller.save()
                print('>> 正在保存数据')
                time.sleep(2)
                view.show_bye()
                break
            elif num == 'M':
                view.show_operation_interface()
            elif num == 'admin':
                controller.admin()


if __name__ == '__main__':
    Main()

